<link rel="stylesheet" type="text/css" href="css/style.css" />



<script type="text/javascript">

{

<!--

function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}

//-->

</script>



<?php

$u=$_SESSION['username'];

?>

<?php

include("conf/dbconect.php");

?>

<?php

  $sql="select * from member where username='$u'";

  $result=mysql_query($sql);

  $rows=@mysql_fetch_array($result);

?>

<?php



  if(isset($_POST['btndangtin']))

  {   $td=$_POST['txttieude'];

      $nguoidang=$rows['fullname'];

      $chidoan=$_POST['cbbchidoan'];

      $diem=$_POST['txtdiem'];

      $datepicker=$_POST['datepicker'];

      $now = getdate();

      $d=$now["mday"];

      $m=$now["mon"];

      $y=$now["year"];

      /*$dk=$_POST['cbbday'];

      $mk=$_POST['cbbmonth'];

      $yk=$_POST['cbbyear'];*/

      $noidung=$_POST['editor1'];

    include('conf/dbconect.php');



    $sql="INSERT INTO baidang(tieude,noidung,nguoidang,thoigiandang,thoigianketthuc,chidoan,diem) values('$td','$noidung','$nguoidang',CONCAT('$y','-','$m','-','$d'),'$datepicker','$chidoan','$diem')";

      $result=mysql_query($sql);

      if($result)

      {

        

        {

        ?>

                <script language="javascript">

          window.alert('Đăng tin thành công');

          window.location="index.php";

                </script>

                <?php

        }

        ?>

        <script language="javascript">

          window.alert('Đăng tin thành công');

          window.location="index.php";

                </script>

      <?php

      }

    else

      echo' Đăng tin thất bại:'.mysql_error();

}

?>

<div id="dangtin">

  <h2>ĐĂNG PHONG TRÀO MỚI</h2> <hr/>

	<form action="" name="frmdangtin" method="post" onSubmit="return checkInput();" enctype="multipart/form-data">

		<table border="1" width="500" style="width:100%">

			<tr>

				<td align="right" style="background:#99FFFF"><b>Tiêu đề:<font color="#DD0000">*</font></b></td>

				<td style="background:#CCFFFF"><input type="text" name="txttieude" id="txttieude" placeholder="Nhập tiêu đề" size="80"> </td>

			</tr>



			<tr>

				<td align="right" style="background:#99FFFF"><b>Điểm:<font color="#DD0000">*</font></b></td>

				<td style="background:#CCFFFF"><input type="text" name="txtdiem" id="txtdiem" placeholder="Nhập số điểm rating" size="80"> Điểm</td>

			</tr>



			

      <tr>

        <td align="right" style="background:#99FFFF"><b>Chi đoàn<font color="#DD0000">*</font></b></td>

        <td style="background:#CCFFFF">

          <select name="cbbchidoan">

            <option value="" style="width: 170px" selected="selected">--Chọn chi đoàn--</option>

            <?php

              require_once('conf/dbconect.php');

              $sql="select * from chidoanlop order by chidoanid ASC";

              $result=mysql_query($sql);

              while($rows=@mysql_fetch_array($result))

              {

            ?>  

            <option value="<?php echo $rows['tenchidoan'] ;?>"><?php echo $rows['tenchidoan'] ;?></option>

              <?php 

              }

            ?>

          </select>

        </td>

      </tr>



      <tr>

        <td align="right" style="background:#99FFFF"><b>Tiêu đề:<font color="#DD0000">*</font></b></td>

        <td style="background:#CCFFFF"><p><input type="text" name="datepicker" id="datepicker" placeholder="Chọn ngày kết thúc" size="40"></p> </td>

      </tr>



			<tr>

				<td align="right" style="background:#99FFFF"> <b>Mô tả chi tiết:<font color="#DD0000">*</font></b></td>

				<td style="background:#CCFFFF"><textarea class="ckeditor" id="editor1" rows="20" cols="65" name="editor1"></textarea></td>

			</tr>



			<tr>

				<td colspan="2"> <center><input type="submit" value="ĐĂNG TIN" name="btndangtin">

				<input type="reset" value="NHẬP LẠI" name="btnnhaplai"></center></td>

			</tr>

		</table>

	</form>

</div>

  <script language="javascript" type="text/javascript">

    CKEDITOR.replace('editor1',{

      filebrowserBrowseUrl: 'browser/browse.php',

      filebrowserImageBrowseUrl: 'browser/browse.php?type=Images',

      filebrowserUploadUrl: 'uploader/upload.php',

      filebrowserImageUploadUrl: 'uploader/upload.php?type=Images',

      filebrowserWindowWidth: '900',

      filebrowserWindowHeight: '400',

      filebrowserBrowseUrl: 'ckfinder/ckfinder.html',

      filebrowserImageBrowseUrl: 'ckfinder/ckfinder.html?Type=Images',

      filebrowserFlashBrowseUrl: 'ckfinder/ckfinder.html?Type=Flash',

      filebrowserUploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',

      filebrowserImageUploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',

      filebrowserFlashUploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'

    });

  </script>